﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ApplLogic.ApplClasses;
using WinForms_client.UiObjects;

namespace WinForms_client
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            #region MyRegion


            Ui_ShiftRequest a_night = new Ui_ShiftRequest();
            a_night.Begin = DateTime.Parse("18.04.2012 00:00:00");
            a_night.End = DateTime.Parse("18.04.2012 08:00:00");
            a_night.RequestType = eType.WANTED;
            Ui_ShiftRequest a_noon = new Ui_ShiftRequest();
            a_noon.Begin = DateTime.Parse("18.04.2012 08:00:00");
            a_noon.End = DateTime.Parse("18.04.2012 16:00:00");
            a_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest a_evening = new Ui_ShiftRequest();
            a_evening.Begin = DateTime.Parse("18.04.2012 16:00:00");
            a_evening.End = DateTime.Parse("18.04.2012 23:59:59");
            a_evening.RequestType = eType.WANTED;

            Ui_ShiftRequest b_night = new Ui_ShiftRequest();
            b_night.Begin = DateTime.Parse("19.04.2012 00:00:00");
            b_night.End = DateTime.Parse("19.04.2012 08:00:00");
            b_night.RequestType = eType.WANTED;
            Ui_ShiftRequest b_noon = new Ui_ShiftRequest();
            b_noon.Begin = DateTime.Parse("19.04.2012 08:00:00");
            b_noon.End = DateTime.Parse("19.04.2012 16:00:00");
            b_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest b_evening = new Ui_ShiftRequest();
            b_evening.Begin = DateTime.Parse("19.04.2012 16:00:00");
            b_evening.End = DateTime.Parse("19.04.2012 23:59:59");
            b_evening.RequestType = eType.WANTED;

            Ui_ShiftRequest c_night = new Ui_ShiftRequest();
            c_night.Begin = DateTime.Parse("20.04.2012 00:00:00");
            c_night.End = DateTime.Parse("20.04.2012 08:00:00");
            c_night.RequestType = eType.WANTED;
            Ui_ShiftRequest c_noon = new Ui_ShiftRequest();
            c_noon.Begin = DateTime.Parse("20.04.2012 08:00:00");
            c_noon.End = DateTime.Parse("20.04.2012 16:00:00");
            c_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest c_evening = new Ui_ShiftRequest();
            c_evening.Begin = DateTime.Parse("20.04.2012 16:00:00");
            c_evening.End = DateTime.Parse("20.04.2012 23:59:59");
            c_evening.RequestType = eType.WANTED;

            Ui_ShiftRequest d_night = new Ui_ShiftRequest();
            d_night.Begin = DateTime.Parse("21.04.2012 00:00:00");
            d_night.End = DateTime.Parse("21.04.2012 08:00:00");
            d_night.RequestType = eType.WANTED;
            Ui_ShiftRequest d_noon = new Ui_ShiftRequest();
            d_noon.Begin = DateTime.Parse("21.04.2012 08:00:00");
            d_noon.End = DateTime.Parse("21.04.2012 16:00:00");
            d_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest d_evening = new Ui_ShiftRequest();
            d_evening.Begin = DateTime.Parse("21.04.2012 16:00:00");
            d_evening.End = DateTime.Parse("21.04.2012 23:59:59");
            d_evening.RequestType = eType.WANTED;

            Ui_ShiftRequest e_night = new Ui_ShiftRequest();
            e_night.Begin = DateTime.Parse("22.04.2012 00:00:00");
            e_night.End = DateTime.Parse("22.04.2012 08:00:00");
            e_night.RequestType = eType.WANTED;
            Ui_ShiftRequest e_noon = new Ui_ShiftRequest();
            e_noon.Begin = DateTime.Parse("22.04.2012 08:00:00");
            e_noon.End = DateTime.Parse("22.04.2012 16:00:00");
            e_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest e_evening = new Ui_ShiftRequest();
            e_evening.Begin = DateTime.Parse("22.04.2012 16:00:00");
            e_evening.End = DateTime.Parse("22.04.2012 23:59:59");
            e_evening.RequestType = eType.WANTED;

            Ui_ShiftRequest f_night = new Ui_ShiftRequest();
            f_night.Begin = DateTime.Parse("23.04.2012 00:00:00");
            f_night.End = DateTime.Parse("23.04.2012 08:00:00");
            f_night.RequestType = eType.WANTED;
            Ui_ShiftRequest f_noon = new Ui_ShiftRequest();
            f_noon.Begin = DateTime.Parse("23.04.2012 08:00:00");
            f_noon.End = DateTime.Parse("23.04.2012 16:00:00");
            f_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest f_evening = new Ui_ShiftRequest();
            f_evening.Begin = DateTime.Parse("23.04.2012 16:00:00");
            f_evening.End = DateTime.Parse("23.04.2012 23:59:59");
            f_evening.RequestType = eType.WANTED;

            Ui_ShiftRequest g_night = new Ui_ShiftRequest();
            g_night.Begin = DateTime.Parse("24.04.2012 00:00:00");
            g_night.End = DateTime.Parse("24.04.2012 08:00:00");
            g_night.RequestType = eType.WANTED;
            Ui_ShiftRequest g_noon = new Ui_ShiftRequest();
            g_noon.Begin = DateTime.Parse("24.04.2012 08:00:00");
            g_noon.End = DateTime.Parse("24.04.2012 16:00:00");
            g_noon.RequestType = eType.WANTED;
            Ui_ShiftRequest g_evening = new Ui_ShiftRequest();
            g_evening.Begin = DateTime.Parse("24.04.2012 16:00:00");
            g_evening.End = DateTime.Parse("24.04.2012 23:59:59");
            g_evening.RequestType = eType.WANTED;

            UI_Day sunday = new UI_Day();
            sunday.Date = DateTime.Parse("18.04.2012");
            sunday.Day = DayOfWeek.Sunday;
            sunday.DayRequests.Add(a_night);
            sunday.DayRequests.Add(a_noon);
            sunday.DayRequests.Add(a_evening);

            UI_Day monday = new UI_Day();
            sunday.Date = DateTime.Parse("19.04.2012");
            sunday.Day = DayOfWeek.Monday;
            sunday.DayRequests.Add(b_night);
            sunday.DayRequests.Add(b_noon);
            sunday.DayRequests.Add(b_evening);

            UI_Day tuesday = new UI_Day();
            sunday.Date = DateTime.Parse("20.04.2012");
            sunday.Day = DayOfWeek.Tuesday;
            sunday.DayRequests.Add(c_night);
            sunday.DayRequests.Add(c_noon);
            sunday.DayRequests.Add(c_evening);

            UI_Day wednesday = new UI_Day();
            sunday.Date = DateTime.Parse("21.04.2012");
            sunday.Day = DayOfWeek.Wednesday;
            sunday.DayRequests.Add(d_night);
            sunday.DayRequests.Add(d_noon);
            sunday.DayRequests.Add(d_evening);

            UI_Day thursady = new UI_Day();
            sunday.Date = DateTime.Parse("22.04.2012");
            sunday.Day = DayOfWeek.Thursday;
            sunday.DayRequests.Add(e_night);
            sunday.DayRequests.Add(e_noon);
            sunday.DayRequests.Add(e_evening);

            UI_Day friday = new UI_Day();
            sunday.Date = DateTime.Parse("23.04.2012");
            sunday.Day = DayOfWeek.Friday;
            sunday.DayRequests.Add(f_night);
            sunday.DayRequests.Add(f_noon);
            sunday.DayRequests.Add(f_evening);

            UI_Day saturday = new UI_Day();
            sunday.Date = DateTime.Parse("24.04.2012");
            sunday.Day = DayOfWeek.Saturday;
            sunday.DayRequests.Add(g_night);
            sunday.DayRequests.Add(g_noon);
            sunday.DayRequests.Add(g_evening);



            UI_Week week = new UI_Week();
            week.FirstDay = DateTime.Parse("18.04.2012 08:00:00");
            week.LastDay = DateTime.Parse("25.04.2012 23:59:59");
            week.Days.Add(sunday);
            week.Days.Add(monday);
            week.Days.Add(tuesday);
            week.Days.Add(wednesday);
            week.Days.Add(thursady);
            week.Days.Add(friday);
            week.Days.Add(saturday);

		 
            #endregion


            //#region Person
            //Pesron p1 = new Pesron();
            //p1.age = 17;
            //p1.name = "Lior";

            //Pesron p2 = new Pesron();
            //p1.age = 14;
            //p1.name = "David";

            //Pesron p3 = new Pesron();
            //p1.age = 14;
            //p1.name = "Zaza";

            //List<Pesron> persons = new List<Pesron>();
            //persons.Add(p1);
            //persons.Add(p2);
            //persons.Add(p3);
            //#endregion

            List<MyCell> cells = new List<MyCell>();
            MyCell ce = new MyCell();
            ce.Type = eType.WANTED;

            MyCell ce2 = new MyCell();
            ce.Type = eType.FORBIDDEN;

            cells.Add(ce);
            cells.Add(ce2);

          

            DataGridViewComboBoxColumn col1 = new DataGridViewComboBoxColumn();
            col1.DataSource = cells;
            col1.Name = "Col1";
            col1.HeaderText = "Sunday";
            col1.DisplayMember = "type";
            col1.ValueMember = "type";
            this.dataGridView1.Columns.Add(col1);


            DataGridViewComboBoxColumn col2 = new DataGridViewComboBoxColumn();
            col2.DataSource = cells;
            col2.HeaderText = "Monday";
            col2.DisplayMember = "type";
            
            this.dataGridView1.Columns.Add(col2);

            List<string> lstn = new List<string> { "aa", "bb", "cc" };
            this.dataGridView1.DataSource = lstn;
//            this.dataGridView1.Columns[2].Visible = false;
            
            List<DataGridViewComboBoxColumn> colList = new List<DataGridViewComboBoxColumn>();

            this.dataGridView1.AutoGenerateColumns = true;
            this.dataGridView1.AllowUserToAddRows = true; ;

        }

        public class MyCell
        {
            public eType Type{ get; set; }
            public string Name { get; set; }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s1 = dataGridView1[0, 0].ToString();
            int t;
        }
    }
}
